<template>
  <div>
    <el-card class="box-card">
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="用户名">
          <el-input type="textarea"
                    :autosize="{ minRows: 2, maxRows: 4}" v-model="form.prescription"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input type="textarea"
                    :autosize="{ minRows: 2, maxRows: 4}" v-model="form.results"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">立即创建</el-button>
          <el-button @click="cancel">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>

</template>

<script>
  import { edit, findById } from '@/network/doctorAdvice'

  export default {
    name: 'DoctorAdviceEdit',
    created() {
      this.getUser()
      this.findDoctor()
    },
    methods: {
      getUser() {
        findById(window.sessionStorage.getItem("ddid")).then(res => {
          console.log(res)
          this.form = res.data.data
        })
      },
      onSubmit() {
        edit(this.form).then(res => {
          this.$router.back(1)
        })
      },
      cancel() {
        this.$router.back(1)
      },
      findDoctor() {
        findDoctor().then(res => {
          console.log(res.data.data.records)
          this.doctors = res.data.data.records
        })
      },
    },
    data() {
      return {
        form: {
        },
        doctors: []
      }
    }
  }
</script>

<style scoped>

</style>
